package com.ants.boot.system.controller;

import com.ants.boot.core.Response;
import com.ants.boot.system.service.SysUploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 蚂蚁会花呗
 * @date 2022/4/19 16:09
 * 图片上传
 */
@RestController
@RequestMapping("/system/upload")
@Api(tags = "文件上传")
public class SysUploadController {

    @Autowired
    private SysUploadService sysUploadService;

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping("img")
    @ApiOperation(value = "图片上传",notes = "单个图片上传")
    public Response img(@RequestParam(value = "file") MultipartFile file){
        return Response.okData(sysUploadService.uploadImg(file));
    }



}
